package com.ldzy.webase.controller;

import com.ldzy.webase.annotation.PassToken;
import com.ldzy.webase.entity.TodayCuisine;
import com.ldzy.webase.service.TodayCuisineService;
import com.ldzy.webase.utils.Response;
import com.ldzy.webase.utils.ResponseCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ：Lq
 * @version ：1.0
 * @date ：2022/11/16 11:11
 * @description ：查询今日菜系所有菜品-可根据今日24小时查询新上新菜品
 */
@RestController
@ResponseBody
@RequestMapping("/todayCuisine")
public class TodayCuisineController {
    @Autowired
    TodayCuisineService todayCuisineService;

    /**
     * @author ：Lq
     * @date ：2022/11/16 11:14
     * @description ：查询今日菜系所有菜品-可根据今日24小时查询新上新菜品
     */
    @GetMapping("/list")
    @PassToken
    public Response getAllTodayCuisine(@RequestParam(value = "is24Hour", required = false) Boolean is24Hour) {
        List<TodayCuisine> todayCuisineList = todayCuisineService.getAllTodayCuisine(is24Hour);

        // 将 数据 返回给前端
        return Response.build(ResponseCode.SUCCESS_LOGIN, todayCuisineList);
    }
}
